var http = require('http');
var url = require('url');
var util = require('util');

const fs = require('fs');
 
http.createServer(function(req, res){
  // console.log(req.url);
  // console.log(req.method);
  // console.log(req.headers);

  if (req.method = 'GET') {
    res.writeHead(200, {'Content-Type': 'text/plain; charset=utf8'});

    // 解析 url 参数
    var params = url.parse(req.url, true).query;
    res.write("网站名：" + params.name);
    res.write("\n");
    res.write("网站 URL：" + params.url);
    res.end();
  }
 
}).listen(9527, function () {
  console.log('服务运行在 http://127.0.0.1:9527');
});